//
//  LZVideoPresenter.m
//  laziz_Consumer
//
//  Created by xbnzd on 16/11/22.
//  Copyright © 2016年 XBN. All rights reserved.
//

#import "LZVideoPresenter.h"
#import "NetworkServiceManager.h"
#import "MJExtension.h"
#import "LZUserModel.h"

extern NSString *merchant;

@implementation LZVideoPresenter


#pragma mark -
#pragma mark 视频下载

/**
 视频下载
 
 @param urlStr 下载地址
 @param successBlock <#successBlock description#>
 @param failedBlock <#failedBlock description#>
 */
+ (NSURLSessionDownloadTask *)downLoadVideoWithURLStr:(NSString *)urlStr Progress:(void (^)(NSProgress *))progressBlock ResultSuccess:(void (^)(NSURL *))successBlock ResultFailed:(void (^)(NSString *))failedBlock
{
    NSString *str = [NSString stringWithFormat:@"%@%@",APIBaseImageUrl,urlStr];
   return  [[NetworkServiceManager manager] executeDownloadTask:str progress:progressBlock completion:^(NSURLResponse *response, NSURL *filePath, NSError *error) {
        if (filePath != nil) {
            if (successBlock) {
                successBlock(filePath);
            }
        }else{
            if (failedBlock) {
                failedBlock(@"视频加载失败,请稍后再试");
            }
        }
    }];
}


@end
